<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCollection extends Migration{
    /**
     * 简历采集跟踪表
     * @return void
     */
    public function up(){
        Schema::create('collection_track_resume', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->comment = '简历采集跟踪表';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->index('resume_id')->unsigned()->comment('关联简历id');
            $table->string('web_id', 100)->default('')->comment('当前网站的简历唯一ID值');
            $table->string('web_main', 60)->default('')->comment('所属网站');
            $table->string('source', 100)->default('')->comment('简历来源地址');
            $table->unique(['web_id', 'web_main']);
        });
        /**
         * 个人简历采集临时表
         * @return void
         */
        Schema::create('collection_resume', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->string('name', 60)->default('')->comment('姓名');
            $table->tinyInteger('sex')->unsigned()->default(0)->comment('性别');
            $table->date('birthday')->default('0000-00-00')->comment('生日');
            $table->tinyInteger('education')->unsigned()->default(0)->comment('学历');
            $table->mediumInteger('homeaddress')->unsigned()->default(0)->comment('现住址');
            $table->string('expectedsalary', 12)->default('')->comment('期望薪资');
            $table->tinyInteger('isexpectedsalary')->nullable()->comment('显示面议');
            $table->tinyInteger('work_year')->unsigned()->default(0)->comment('相关工作经验');
            $table->string('intentionjobs', 60)->default('')->comment('意向工作岗位');
            $table->mediumInteger('jobsort1')->unsigned()->default(0)->comment('工作岗位1');
            $table->mediumInteger('jobsort2')->unsigned()->default(0)->comment('工作岗位2');
            $table->mediumInteger('jobsort3')->unsigned()->default(0)->comment('工作岗位3');
            $table->mediumInteger('jobsort4')->unsigned()->default(0)->comment('工作岗位4');
            $table->mediumInteger('jobsort5')->unsigned()->default(0)->comment('工作岗位5');
            $table->mediumInteger('jobarea1')->unsigned()->default(0)->comment('工作地区1');
            $table->mediumInteger('jobarea2')->unsigned()->default(0)->comment('工作地区2');
            $table->mediumInteger('jobarea3')->unsigned()->default(0)->comment('工作地区3');
            $table->mediumInteger('jobarea4')->unsigned()->default(0)->comment('工作地区4');
            $table->mediumInteger('jobarea5')->unsigned()->default(0)->comment('工作地区5');
            $table->text('introduction')->default('')->comment('介绍或技能介绍');
            $table->string('mobile', 60)->default('')->comment('手机');
            $table->string('email', 100)->default('')->comment('邮箱');
            $table->string('qq', 20)->default('')->comment('qq');
            $table->timestamp('regtime')->nullable()->comment('简历注册时间');
            $table->timestamp('updatetime')->nullable()->comment('简历更新时间');
            $table->string('avatar', 60)->default('')->comment('个人头像');
            $table->string('address', 255)->default('')->comment('详细地址');
            $table->tinyInteger('job_status')->unsigned()->default(1)->comment('求职状态(不在职，正在找工作|在职，打算近期换工作)');
            $table->mediumInteger('census')->unsigned()->default(0)->comment('户籍');
            $table->tinyInteger('marital')->unsigned()->default(0)->comment('婚姻状况');
            $table->tinyInteger('height')->unsigned()->default(0)->comment('身高');
            $table->tinyInteger('show_type')->unsigned()->default(0)->comment('显示状态(1显示，2跳过该简历，3已添加至正式库)');
            $table->string('place_name', 100)->default('')->comment('地标名称');
            $table->string('longitude', 60)->default('')->comment('地标经度');
            $table->string('latitude', 60)->default('')->comment('地标纬度');
        });

        /** 采集工作经历表 resume_work_exp **/
        Schema::create('collection_resume_work_exp', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->string('company', 60)->default('')->comment('公司名称');
            $table->smallInteger('industry')->unsigned()->default(0)->comment('所属行业');
            $table->tinyInteger('comkind')->unsigned()->default(0)->comment('公司性质');
            $table->string('scale')->default('')->comment('公司规模');
            $table->date('starttime')->default('0000-00-00')->comment('在职时间');
            $table->date('endtime')->default('0000-00-00')->comment('离职时间	Null代表在职');
            $table->string('post', 60)->default('')->comment('职位名称');
            $table->text('content')->default('')->comment('工作描述');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 采集教育培训经历表 resume_education_exp  **/
        Schema::create('collection_resume_education_exp', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->tinyInteger('edu_type')->unsigned()->nullable()->comment('教育类型');
            $table->string('school', 60)->default('')->comment('学校名称');
            $table->date('starttime')->default('0000-00-00')->comment('就读时间');
            $table->date('endtime')->default('0000-00-00')->comment('结束时间	Null代表在校');
            $table->string('speciality', 200)->default('')->comment('专业名称');
            $table->tinyInteger('education')->unsigned()->default(0)->comment('学历	Null代表培训');
            $table->tinyInteger('type')->unsigned()->default(0)->comment('是否统招');
            $table->text('description')->default('')->comment('描述');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 采集项目经验表 resume_project_exp   **/
        Schema::create('collection_resume_project_exp', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->string('project_name', 60)->default('')->comment('项目名称');
            $table->date('starttime')->default('0000-00-00')->comment('项目开始时间');
            $table->date('endtime')->default('0000-00-00')->comment('结束时间	Null代表在职');
            $table->string('post', 60)->default('')->comment('担任职务');
            $table->text('content')->default('')->comment('项目介绍');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });


        /** 采集语言能力表 resume_language_skill   **/
        Schema::create('collection_resume_language_skill', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->tinyInteger('language')->unsigned()->default(0)->comment('语种');
            $table->tinyInteger('degree')->unsigned()->default(0)->comment('熟练程度	简单沟通|读写精通|商务洽谈|同声翻译');
            $table->tinyInteger('level')->unsigned()->default(0)->comment('语言等级');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 采集技能专长表 resume_skill   **/
        Schema::create('collection_resume_skill', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->string('skillname', 60)->default('')->comment('技能名称');
            $table->tinyInteger('degree')->unsigned()->default(0)->comment('熟练程度	入门|熟练|精通');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 采集证书表 resume_certificate   **/
        Schema::create('collection_resume_certificate', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->string('certificate_name', 100)->default('')->comment('证书名称');
            $table->timestamp('gettime')->nullable()->comment('获得时间');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 采集我的作品表 resume_works   **/
        Schema::create('collection_resume_works', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->string('works_name', 60)->default('')->comment('作品名称');
            $table->text('description')->default('')->comment('作品描述');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 采集我的作品图片 resume_works_img   **/
        Schema::create('collection_resume_works_img', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->integer('works_id')->unsigned()->index('works_id')->default(0)->comment('所属作品id');
            $table->string('imgurl', 255)->default('')->comment('图片地址');
            $table->string('originalimg', 255)->default('')->comment('原文件名');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        /** 采集其它信息 resume_other   **/
        Schema::create('collection_resume_other', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('resume_id')->unsigned()->index('resume_id')->default(0)->comment('简历id');
            $table->string('title', 100)->default('')->comment('主题');
            $table->text('content')->default('')->comment('内容');
            $table->timestamp('addtime')->nullable()->comment('添加时间');
            $table->timestamp('updatetime')->nullable()->comment('更新时间');
        });

        //**************************************************************************************************************
        /**
         * 企业采集跟踪表
         * @return void
         */
        Schema::create('collection_track_company', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->comment = '简历采集跟踪表';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('com_id')->index('com_id')->unsigned()->comment('关联企业id');
            $table->string('web_id', 100)->default('')->comment('当前网站的企业唯一ID值');
            $table->string('web_main', 60)->default('')->comment('所属网站');
            $table->string('source', 100)->default('')->comment('企业来源地址');
            $table->unique(['web_id', 'web_main']);
        });
        /**
         * 企业采集临时表
         * @return void
         */
        Schema::create('collection_company', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->comment = '企业采集临时表';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->string('name', 100)->default('')->comment('企业名称');
            $table->string('address', 200)->default('')->comment('地址');
            $table->string('contacts', 25)->default('')->comment('企业负责人');
            $table->string('phone', 60)->default('')->comment('座机电话');
            $table->string('mobile', 60)->default('')->comment('手机');
            $table->string('email', 60)->default('')->comment('邮箱');
            $table->string('web', 250)->default('')->comment('网址');
            $table->text('remarks')->default('')->comment('备注');
        });
    }

    /**
     * 采集表
     * 添加时间 2017-4-20
     */
    public function down(){
        Schema::dropIfExists('collection_track_resume');
        Schema::dropIfExists('collection_resume');
        Schema::dropIfExists('collection_resume_work_exp');
        Schema::dropIfExists('collection_resume_education_exp');
        Schema::dropIfExists('collection_resume_project_exp');
        Schema::dropIfExists('collection_resume_Language_skill');
        Schema::dropIfExists('collection_resume_skill');
        Schema::dropIfExists('collection_resume_certificate');
        Schema::dropIfExists('collection_resume_works');
        Schema::dropIfExists('collection_resume_works_img');
        Schema::dropIfExists('collection_resume_other');
        //**********************************************************************************************************
        Schema::dropIfExists('collection_track_company');
        Schema::dropIfExists('collection_company');
    }
}
